<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
 * WYMeditor : what you see is What You Mean web-based editor
 * Copyright (C) 2006 H.O.net - http://www.honet.be/
 * Dual licensed under the MIT (MIT-license.txt)
 * and GPL (GPL-license.txt) licenses.
 *
 * For further information visit:
 * 		http://www.wymeditor.org/
 *
 * File Name:
 *		editor.htm
 *		Main editor container.
 *		See the documentation for more info.
 *
 * File Authors:
 * 		Jean-François Hovinne (jf.hovinne@wymeditor.org)
 *		Daniel Reszka (d.reszka@wym-editor.org)
-->

<html>
<head>
<title>WYMeditor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="skins/editor-skin.css" />
<script type="text/javascript" src="browser.js"></script>
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="config.js"></script>
<script type="text/javascript" src="wym.js"></script>
</head>

<body id="main_body" class="editor" onload="init();" onfocusout="bCleanPaste=false;displayPasteCleanup(true)">
<div id="topdiv">

<div id="header">
<a href="http://www.wymeditor.org/"><img id="logo-main" src="images/wym-editor.png" width="127" height="19" alt="WYMeditor logo" /></a>
</div>

<!-- caretpos keeps cursor position -->
<input type="hidden" name="caretpos" id="caretpos" value="0" />

	<!-- for debugging purposes -->
	<div id="m_debug">
	<a id="m_remove_attrs" title="Remove all attributes from selected element (for debugging purposes)" href="#" onclick="removeAttrs();getCleanHTML()">Remove All Attributes</a>
	<a id="m_cursor_pos" title="Get cursor position (for debugging purposes)" href="#" onclick="window.status=getCaretPos()">Cursor Position</a>
	<a id="m_selected_element" title="Get selected element (for debugging purposes)" href="#" onclick="window.status=selectedId()">Selected Element</a>
	</div>


<div id="toolbars">

 	<!-- basic commands -->
	<div id="m_basic">
	<a id="m_strong" title="Strong" href="#" onclick="execCom('Bold');getCleanHTML();return false;">Strong</a>
	<a id="m_italic" title="Italics" href="#" onclick="execCom('Italic');getCleanHTML();return false;">Italic</a>
	<a id="m_sup" title="Supercript" href="#" onclick="execCom('Superscript');getCleanHTML();return false;">Superscript</a>
	<a id="m_sub" title="Subscript" href="#" onclick="execCom('Subscript');getCleanHTML();return false;">Subscript</a>
	<!-- we must remove class attribute before converting from P to OL or UL -->
	<a id="m_ordered_list" title="Ordered list" href="#" onclick="removeClassAttr();execCom('InsertOrderedList');getCleanHTML();return false;">Ordered List</a>
	<a id="m_unordered_list" title="Unordered list" href="#" onclick="removeClassAttr();execCom('InsertUnorderedList');getCleanHTML();return false;">Unordered List</a>
	</div>
	
	<div id="m_undo_redo">
	<a id="m_undo" title="Undo" href="#" onclick="execCom('Undo');return false;">Undo</a>
	<a id="m_redo" title="Redo" href="#" onclick="execCom('Redo');return false;">Redo</a>
	</div>

	<!-- objects : link, image, table -->
	<div id="m_objects">
	<a id="m_link" title="Create link" href="#" onclick="openDialog('link');getCleanHTML();return false;">Link</a>
	<a id="m_unlink" title="Unlink" href="#" onclick="execCom('Unlink');getCleanHTML();return false;">Unlink</a>
	<a id="m_image" title="Insert image" href="#" onclick="openDialog('image');getCleanHTML();return false;">Image</a>
	<a id="m_table" title="Insert table" href="#" onclick="openDialog('table');getCleanHTML();return false;">Table</a>
	</div>

	<!-- table : advanced commands -->
	<div id="m_table_advanced">
	<a id="m_table_insert_row_after" title="Insert new row after current row" href="#" onclick="table_insertObject('ROW',false);getCleanHTML();return false;">Insert Row After</a>
	<a id="m_table_insert_row_before" title="Insert new row before current row" href="#" onclick="table_insertObject('ROW',true);getCleanHTML();return false;">Insert Row Before</a>
	<a id="m_table_insert_col_after" title="Insert new column after current column" href="#" onclick="table_insertObject('COL',false);getCleanHTML();return false;">Insert Col After</a>
	<a id="m_table_insert_col_before" title="Insert new column before current column" href="#" onclick="table_insertObject('COL',true);getCleanHTML();return false;">Insert Col Before</a>
	<a id="m_table_delete_row" title="Delete current row" href="#" onclick="table_deleteObject('ROW');getCleanHTML();return false;">Delete Row</a>
	<a id="m_table_delete_col" title="Delete current column" href="#" onclick="table_deleteObject('COL');getCleanHTML();return false;">Delete Col</a>
	</div>

	<!-- advanced commands  -->
	<div id="m_advanced">
	<a id="m_paste" title="Paste from Word" href="#" onclick="openDialog('paste');getCleanHTML();return false;">Paste from Word</a>
	<a id="m_html" title="View source code" href="#" onclick="getCleanHTML();htmlVisible();return false;">Show / Hide HTML</a>
	<a id="m_preview" title="Open preview" href="#" onclick="openPreview();return false;">Preview</a>
	</div>
</div>

<div id="panels">
	<!-- containers (h1..h6, pre, ...) -->
	<div id="m_containers">
	<h2>Containers</h2>
	<a id="m_paragraph" href="#" onclick="setContainer('P');getCleanHTML();return false;">Paragraph</a>
	<a id="m_h1" href="#" onclick="setContainer('H1');getCleanHTML();return false;">Heading 1</a>
	<a id="m_h2" href="#" onclick="setContainer('H2');getCleanHTML();return false;">Heading 2</a>
	<a id="m_h3" href="#" onclick="setContainer('H3');getCleanHTML();return false;">Heading 3</a>
	<a id="m_h4" href="#" onclick="setContainer('H4');getCleanHTML();return false;">Heading 4</a>
	<a id="m_h5" href="#" onclick="setContainer('H5');getCleanHTML();return false;">Heading 5</a>
	<a id="m_h6" href="#" onclick="setContainer('H6');getCleanHTML();return false;">Heading 6</a>
	<a id="m_pre" href="#" onclick="setContainer('PRE');getCleanHTML();return false;">Preformatted</a>
	<a id="m_blockquote" href="#" onclick="setContainer('BLOCKQUOTE');getCleanHTML();return false;">Blockquote</a>
	</div>

	<!-- classes : setClass(class name,list of allowed containers,list of conflicting classes) -->
	<div id="m_class">
	<h2>Classes</h2>
	<a id="m_remove_class" href="#" onclick="removeClassAttr();getCleanHTML();displayClasses();return false;">Remove Classes</a>
	<h3>Common</h3>
	<a href="#" name="hidden-note" onclick="setClass('hidden-note','*','*');getCleanHTML();return false;">note (hidden)</a>
	<h3>Paragraph</h3>
	<a href="#" name="important" onclick="setClass('important','P','','*');getCleanHTML();return false;">important</a>
	<a href="#" name="date" onclick="setClass('date','P,DIV','*');getCleanHTML();return false;">date</a>
	<a href="#" name="block" onclick="setClass('block','P,DIV','','important');getCleanHTML();return false;">side block</a>
	<h3>Image</h3>
	<a href="#" name="border" onclick="setClass('border','IMG','');getCleanHTML();return false;">border</a>
	<h3>Image a</h3>
	<a href="#" name="thickbox" onclick="setClass('thickbox','A','','*');getCleanHTML();return false;">thickbox</a>
	</div>

	<!-- custom panel -->
	<div id="m_custom">
	<h2>Special</h2>
	<a href="#" title="Insert WYMeditor's description" onclick="insertAtCursor(custom_values['wym_editor_description']);getCleanHTML();return false;">Insert WYMeditor's description</a>
	<a href="#" title="Insert template" onclick="openDialog('template');getCleanHTML();return false;">Insert template</a>
	</div>
	
	<!-- miscellaneous -->
	<div id="m_misc">
	<h2>Info</h2>
	Copy-Paste clean up:<span id="m_paste_cleanup_flag_on">ON</span><span id="m_paste_cleanup_flag_off">OFF</span>
	</div>
</div>

<!-- html value -->
<textarea name="txthtml" id="txthtml" cols="100" rows="20" onkeyup="setHTML()" style="display:none"></textarea>

<!-- the editor - saveCaret saves cursor position - setImgEvent handles click on images -->
<div contentEditable name="editor" id="editor"
	onbeforedeactivate="saveCaret()"
	onkeyup="saveCaret();displayClasses()"
	onclick="saveCaret();release();setImgEvent();displayClasses()"
	oncopy="bCleanPaste=true;displayPasteCleanup(false)"
	oncut="bCleanPaste=true;displayPasteCleanup(false)"
	onbeforepaste="event.returnValue=false"
	onpaste="pasteData()"
	ondrop="event.returnValue=false"
	onresizestart="event.returnValue=false">
</div>

<!-- the editor -->
<iframe id="iframe_editor" src="iframe.htm"></iframe>
<input type="submit" value="Сохранить" onClick="wymApplyClick()"/>
<input type="reset"  value="Отмена"    onClick="cancel()"/>
</div>
<script language="JavaScript" type="text/javascript">
es = window.opener.document.getElementsByName('$form:name');
e = document.getElementById('editor');
e.innerHTML = es[0].value;
function wymApplyClick()
{
	e = document.getElementById('txthtml');
	es[0].disabled = false;
	getCleanHTML();
	es[0].value = e.value;
	window.opener.focus();
	window.close();
}
function cancel()
{
	es[0].disabled = false;
	window.opener.focus();
	window.close();
}
</script>
</body>
</html>
